3. processing and sorting machine basic fsm approach 2

在上一个视频中,我们成功编写了该机器的第一个实现,该机器能够一次处理一个产品。
In the last video, we managed to write the first implementation of this machine that is able to process one product at a time.

现在我们需要管理所有其他按钮的功能。
Right now we need to manage what all the other buttons do.

因此,我们设法启动机器并在启动之前将产品带入饲料中。
So we managed to start the machine and to carry out to the home before starting before enabling the product in feed.

现在,我们需要管理按下停止、保持或紧急按钮时会发生什么。
Right now, we need to manage what should happen when the stop, hold or emergency buttons are being pressed.

因此,让我们开始我们的程序,首先定义按下停止或紧急保持按钮时实际发生的情况。
So let's get onto our program and let's start by defining what should actually happen when either stop or emergency on hold button is pressed.

所以。
So.

我们所说的“停止”或“停止”是什么意思,我们的意思是我们将以一种温和的方式停止机器。
What do we mean with stop or stop, we mean that we are going to stop the machine, let's say, in a soft kind of way.

我们不希望任何产品最终突然掉落在地面上。
We do not want any product to end up on the ground to fall in an abrupt way.

而且,呃,假设我们只想停止循环,而不造成任何实际损害,也不冒对产品、机器本身或人员造成任何实际损害的风险。
And, uh, let's say that we would just want to stop the cycle without causing any any real damage, without risking to cause any real damage to products or to the machine itself or to people.

嗯,如果我们按下紧急按钮,我们将需要立即停止机器,因为有人的安全可能受到威胁。
Um, if instead we have an emergency button being pressed, we will we need to immediately stop the machine because someone's safety may be on the line.

这确实很难阻止。
And this needs to be really hard to stop.

我们不需要关心产品,呃,比如说掉在地板上。
And we do not need to care about products, uh, let's say dropping on the floor.

然后,我们需要暂停机器的生产,并且我们需要它恢复,嗯,一旦我们希望它真正恢复,而不是按下暂停按钮。
And then instead of, uh, uh, the hold button is being pressed, we need to pause the production of the machine and we need it to resume, um, as soon as we want it to actually resume.

所以通过这里上网。
So by going online over here.

您可以看到底部的止损和开始止损之间存在一些差异,如您所见,只要您按住止损,止损就会被推动,并且可视化位于底部的顶部。
You can see some difference between the stop and start stopping on the bottom, as you can see, the stop is being pushed just as long as you hold it and the visualization is top of bottom.

相反,如果紧急按钮起作用,每次我们按下它时,保持都会以相同的方式切换。
Instead, the hold will toggle each time we press it the same way if the emergency button working.

因此,如果按下停止按钮,我们希望停止机器。
So we want to stop the machine if the stop button is being pressed.

同样的困境是紧急情况。
And the dilemma for the same is for emergency.

但当我们再次开始时,我们会检查紧急按钮是否仍然被按下。
But when we start again, we will check if the emergency button is not being pressed still.

如果您按下保持键,保持按钮也是如此。
And the same goes for the hold button if you press hold.

我们想要暂停生产,暂停机器,如果您移除旧按钮,我们希望它能够恢复。
We want to pause the production, pause the machine, and if you remove the old button, we want it to resume.

那么让我们在主程序中进入它。
So let's get into it in our main program.

让我们飞起来,看看我们需要做什么或只是做其他事情。
Let's go flying and let's see what we need to do or just another things.

我认为,嗯,如果您使用停止或紧急按钮停止机器,则假定一旦您再次启动或产品将从机器中移除。
And I think, um, if you stop the machine with either the stop or emergency button, it is assumed that once you start again or the products will be removed from the machine.

因此,例如,如果您将这里的产品添加到中继站,则假设您在停止后启动,它将被手动从机器中移除。
So for if, for instance, here, if you add the product over here on the to the relay station, it is assumed that if you start after stopping, it would be manually removed from the machine.

这是一个简单的假设,如果我们想继续处理机器中已有的产品,我们需要考虑到这一点。
This is a simple assumption that we need to take into consideration if we want to keep processing the products that are already present in the machine.

我们有一个保持按钮。
We have the hold button for that.

那么让我们开始吧。
So let's get into it.

我们将把可视化移到这里,这样我们就可以继续研究它,看看我们需要做什么。
We will move the visualisations over here so we can keep looking into it and let's see what we need to do.

那么我们就从车站开始吧。
So let's start by the stop.

无论我们处于任何状态,我们都需要实际管理这个顶部。
If we are in any state, we need to actually manage this top.

因此,让我们创建一个停止,一个仍在状态机中的状态,但您实际上可以从任何实际状态进入它。
So let's create a stop, a state that is still in the state machine, but you can actually get into it from any actual state.

我写此评论是为了将普通状态与特殊状态分开。
I write this comment to separated the ordinary states from, let's say, the special states.

因此,假设停止状态是等于 1000 的状态。
So let's say that the stop state is the one to state equal to 1000.

所以这就是停止状态。
So this is the stop state.

如果我们不希望任何产品真正掉落到地板上或任何东西上,我们就需要这样做。
If we do not want any product to actually fall onto the floor or into anything, we need to.

只是,呃,为了避免释放任何夹具,所以当杠杆移动时,我们不需要释放水平仪的夹具,当桌子,呃,不移动时,我们不需要释放桌子的夹具在其开始位置。
Just, uh, to avoid releasing any of the griper so we don't need to release the griper of the level when the lever is moving and we do not need to release the gripper of the table when the table is, uh, is not at its beginning position.

所以让我们尝试以,呃,呃,以正确的方式来管理它。
So let's try to manage it in, uh, in, uh, in a correct way.

那么让我们开始吧。
So let's start.

一个装置接一个装置,所以为了和平起见,我们需要在一开始就将其向后移动,所以我们只需将活塞向前移动等于力。
Device by device, so for the peace, we will need to move it back at the beginning, so we will simply have to move piston forward equal to force.

这是我们对活塞唯一需要的东西。
This is the only thing that we need for the piston.

对于我们目前的水平。
For the level we have at.

我们需要将控制杆移至左侧。
We need to move the lever to the left.

所以这里你向左或向右移动,等于力量。
So here you have move left or right, equal to force.

还有继续前进。
There are moving on.

我们需要将电梯向下移动,我们可以做一些类似于我们在开放过程中所做的事情,所以。
We need to have to move the elevator down and we can do something similar to what we did at the opening procedure, so.

我们可以复制电梯轰炸的这一部分并将其粘贴到此处。
We can just copy this part for the bombing of the elevator and paste it down here.

所以这意味着她的电梯,如果你有另一个在路上,你应该等待杠杆被带到左边的位置。
So this means that her elevator, if you have the other on the way, you shall wait for the lever to be brought on the left position.

相反,如果楼层已经离开,您应将电梯向下移动。
Instead, if the level is already left, you shall move the elevator down.

然后继续前进。
Then moving on.

我们需要向上移动导轨,以便我们可以再次复制钻孔的时间并将其粘贴到此处,因为过程非常相似。
We need to move the rail up so we can again copy the timing of the drill and paste it right here, since the procedure is quite similar.

与此同时,我们需要停用演习的激活。
And in the meanwhile, we need to deactivate the activation of the drill.

钻头驱动应与错误相同。
Drill actuation shall become equal the false.

这里我们也将。
Here we shall also.

并且是驱动,所以呃激活应该等于跌倒,然后桌子上的人更少,我们可以对侧翼做类似于桌子的事情,这样我们就可以再次复制这个。
And are actuation, so er activation should be equal to falls and then less men at the table and we can do something similar to the table to the wing so we can again copy this.

如果我们不在起始位置,我们将回到那里。
If we're not at the start position, we shall go back there.

好的,然后我们需要管理夹具,所以只有当我们处于正确的位置时,我们才需要释放产品的夹具。
OK, and then we need to manage the grippers, so we need to release the grippers of the products only if we are in the correct position.

所以在这里,嗯。
So here, um.

好吧,首先,对于桌子来说,只有当我们有拾取位置时,我们才需要释放夹具。
Well, first of all, for what concerns the table, we surely need to release the griper only if we have our pick up position.

所以他们将抓手应该变成等于摔倒在这里了。
So they will griper should become equal to falls over here and the.

这是我们需要在这里管理的另一件事。
Just another thing that is correct that we need to manage over here.

我在这里写的完全不正确,因为假设他们只是用活塞将产品移到这里。
It is quite not right what I wrote over here, because let's say they would just move move the product over here with a piston.

如果我们要推动产品向前发展,我们就会交付产品。
If we are moving a product forward, we deliver.

这不是我们的情况,因为我们一次管理一种产品。
This is not the way in our situation because we are managing one product at a time.

但我们只能说我们是,呃。
But let's just say that we are, uh.

我们实际上导致了剩下的产品发生碰撞。
We were actually led to a collision of products that were left.

所以我们可以在这里,嗯,你知道,实施。
So what we could right over here, um, you know, to implementation.

目前,我们对此并不担心。
Right now, we are not concerned by this.

但后来,如果我们并行推进一切,我们就会让劳工运动结束。
But later on, if we were moving everything in parallel, we shall just let the labor movement finish.

所以在这里我们应该做所有的事情,只在这里做一件事。
So here we should have done everything, just one thing over here.

我们需要释放夹具。
We need to release the grippers.

因此,如果杠杆左传感器为真,我们需要释放级别组 Thurso,级别 Greber 应变为假。
So if the lever left sensor is true, we need to release the level group Thurso level Greber shall become the false.

我想我们可以管理所有的事情。
And I guess we manage all the.

执行器,因此移动一级夹具的活塞,是的,我们还需要禁用进给中的产品,所以我将在这里写下来。
Actuators, so move piston for one level gripper, yes, we need also to disable the product in feed, so I will write it over here.

产品和饲料。
Product and feed.

所以一旦我们停下来,我们就可以回到初始状态。
So as soon as we are stopped, we just we can get back to the initial state.

那么,如果我们处于正确的位置,我们如何判断我们是否处于正确的位置。
So how do we see if we are on the correct position if we have.

我们有最好的 和 处于起始位置,我们的控制杆位于左侧 和 。
We have the best and at the start position and we have the lever on the left and.

我们的电梯在底层。
We have the elevator on the bottom.

让我们换一条新路线,我们有顶部的钻头,真正的顶部传感器,我们是处于巅峰位置的人。
And let's go on a new line, we have the drill on the top, real top sensor, and we are the people at the peak of position.

然后我们就可以开始了,我们可以进入零状态。
Then we should be good to go and we could go to state zero.

这应该管理我们的子状态,我们什么时候需要去这里?
This should manage our substate and when do we need to go here?

每次员工洗手间被压时我们都需要到达这里。
We need to get here every time the staff bathroom is being pressed.

所以我们需要联系州政府,如果我很抱歉的话。
So we need to get to the state if I'm sorry, if.

按下停止按钮,则状态应变为零。
The stop button is pressed, then the state should become zero.

实际上,只有当状态不为零时我们才需要这样做。
Actually, we need to do this only if the state is not already zero.

否则,我们将达到等于 1000 的状态并返回到零。
Otherwise, we would get to the state equal to 1000 and move back to zero.

所以这里我们也需要写。
So here we need also to write.

每个状态都与零不同,这样和底部。
Each state is different from zero right in this way and the bottom.

好吧,让我们来看看。
OK, let's see.

如果这有效的话。
If this works.

下载的是Koya。
That's Koya to download.

让我们启动程序并启动机器。
Let's start the program and start the machine.

例如,让我们尝试在这里停下来。
Let's try to stop here, for instance.

呃,好吧。
Uh, OK.

费用是个东西。
The fee is something.

没有工作,机器挨饿了,但是这头野兽正在移动,仍在前进。
Didn't work and the machine starved the but this beast is all moving, is still being moving forward.

哦对不起。
Oh, sorry.

是的,我会把你的状态写成等于 1000。
Yeah, I shall have written your state equal to one thousand.

是的,这就是错误。
Yes, this was the mistake.

所以。
So.

让我们再试一次。
Let's try this again.

开始。
Start.

停下来,好吗?
Stop, OK?

和。
And.

如果我再次开始,该产品将被删除。
If I start again, the product is removed.

让我们尝试一下这一次的中途交付。
Let's try this one delivery's midway.

问题可能又放回去了。
The problem probably placed back.

我删除了就OK了。
I removed OK.

让我们用电梯试试这个。
Let's try this with the elevator.

当电梯运行时。
When the elevator is moving.

是的,它是顶级的。
Yes, it is top.

好的。
OK.

我们换个位置再试一下,看看真实的情况。
Let's try again in another position and see the real.

和。
And.

所以当钻头下来时。
So when the drill is coming down.

然后它又回来了。
And it goes back up.

好的。
OK.

所以它似乎适用于我们的许多条件,让我们也测试一下桌子在空中移动时的最后一个条件。
So it seems to work for many of our conditions, let's test the last one when the table is moving in the air, too.

那么让我们一起等待大猩猩吧。
So let's wait for the gorilla.

我的意思是,空气很简单,因为它停止了吹。
I mean, the air is quite simple because it was stop blowing.

所以让我们按下停止键。
So let's press stop.

这里。
Here.

你可以看到他带回来的东西。
You can see the that he's brought back there.

好的。
OK.

所以我们设法在这里为停止按钮做了一些漂亮的事情。
So we managed to do something nice over here for the stop button.

让我们继续讨论紧急按钮。
Let's move on to the emergency button.

因此,如果按下紧急按钮,我们实际上需要立即停止一切,并且我们不在乎某些产品是否掉落,我们实际上并不关心电梯是否停在错误的位置,它只需要停下来。
So if the emergency button, we need to actually stop everything immediately and that we don't care if some products are dropped, we don't actually if the elevator stops in a wrong position, it just needs to stop.

就这样,非常简单。
So here it is, quite simple.

因此,如果状态不等于零,我们就按下紧急按钮。
So if the state is not equal to zero and we press an emergency button.

然后我们需要立即归零,当我们这样做时,我们需要实际禁用。
Then we need to get immediately to zero, and while we do that, we need to actually disable.

一切都在机器上。
Everything on the machine.

所以。
So.

实际上,为了确保做到这一点,我们可以简单地添加机器不在状态零下运行的所有条件。
Actually, to be, um, to be quite sure to do that, we could simply add all the conditions for the machine to not be not running over here in the in the state zero.

所以我们可以这样做。
So we can do that.

我们可以看到,我仍然是零移动,活塞前进总是等于力。
We can see that I'm still zero move piston forward is always equal to force.

杠杆移动杠杆的运动(右)始终等于力,杠杆夹具始终等于下降力,并且将电梯向上移动的每个执行器始终等于错误移动。
The movement of the lever move lever, right, is always equal to force the lever gripper is always equal to falls and every actuator they move elevator up is always equal to a false move.

电梯也下来了。
Elevator down as well.

向上移动等于下降,移动、向下钻等于下降以及钻驱动、空气驱动。
Move the bill up is equal to falls, move, drill down is equal to falls as well as the drill actuation, the air actuation.

工作台和工作台夹具的运动。
The movement of the table and the table griper.

所有这一切都等于武力,就看你了,呃,如果你愿意的话,最后一切都让它看起来更好。
All of this are equal to force, it is up to you, uh, if you want to, in the end, everything to make it look nicer.

我去做。
I will do that.

所以也许如果我写得快的话,你就能跟上。
So maybe if I wrote it quickly, you can catch up.

你知道,有了这个,每次你都会从零进入零。
You know, with this, every time you go to zero into zero.

你将会拥有。
You will have.

一切。
Everything.

一切都在这个配置中。
Everything in this configuration.

好的,现在继续我们这里的内容,如果按下紧急按钮,您可以看到。
OK, so moving on to what we here, you can see that if the emergency button is pressed.

一切都将停止。
Everything shall stop.

因此,所有 Matagalpa 驱动达到的水平都会向后移动。
So everything Matagalpa actuation was up to the level will move back.

电梯半路停了下来。
The elevator was stopped midway.

例如,当库存按钮和所有产品中途掉落时,这种情况就不会发生。
It is something that is not happening when the stock button and allsorts any product will be dropped midway, for instance.

让我们从 开始吧。
Let's start at.

并尝试紧急情况,所以在这里,如果我按紧急情况,产品会在中途掉落,并且这是纠正的,因为如果发生紧急情况,我们不在乎我是否在按下紧急情况时按开始,什么也不会发生。
And try the emergency, so here, if I press emergency, the product is dropped midway and this is corrected because if an emergency is happening, we don't care if I press start when the emergency is being pressed and nothing will happen.

哦,该产品将实现的另一件事应该等于落在街上零。
Oh, another thing the product will enable should be equal to falls in the street zero.

因此,让我们补充一下,饲料中的产品,呃,如果它启用的话,也应该等于下降。
So let's add that the product in feed that, uh, if it enables should be equal to falls as well.

那么让我们回到线上吧。
So let's go back on line.

我们一路上学到了变化。
We learned along the line change.

好的。
OK.

所以如果我们从这里开始。
So if we start here.

产品被删除,但不应该发生任何事情来将紧急产品实际删除到标签中。
Products are removed, but nothing should happen to remove the emergency actually products into the label.

以色列和机器再次启动,这是移动电梯时的紧急情况。
Israel and the machine starts again, that's an emergency while moving the elevator.

在这里您可以看到为什么轰炸程序很重要。
Here you can see why the bombing procedure is important.

我们所做的,因为如果我现在在没有敌人程序的情况下启动机器,电梯将不会处于正确的位置。
What we did, because if I started the machine right now without enemy procedure, the elevator would not be in the correct position.

所以人们先开始。
So people start first.

您可以看到爆炸发生并将电梯引导到正确的位置。
You can see the bombing happening and leading the elevator into the correct position.

让我们在另一个临界条件下尝试一下,即当工作台移动时,位置不正确。
And let's try this in another, let's say, critical condition, that is when the table was moving, was not in the correct position.

那么我们就等待钻孔吧。
So let's wait for the drilling.

和。
And.

现在,按下紧急按钮,产品掉落,桌子一开始就处于错误的位置,整个事情发生在产品事件成为现实之前。
Right now, press emergency, the product is dropped and the table is in the wrong position for a start, the whole thing occurs before the product incident becomes true.

有事情发生了,好吧,有什么问题。
Something is happening, OK, there is something wrong.

我猜。
I guess.

您可以看到该表的表现不太好。
You can see the table is not doing quite well.

和。
And.

让我看看是什么。
Let me see what.

这里似乎有什么问题?
What seems to be the issue here?

好的,产品已被正确抓取。
OK, the product is being grabbed correctly.

让我们在紧急情况下再试一次。
Let's try again with emergency.

嗯,这里移动桌子等于跌倒。
Um, move table here is equal to falls.

让我看到这里,移动表应该成为现实,也应该成为一种力量,只要他,呃。
And let me see here, the move table should become true, should become a force as well, as long as he, uh.

嗯。
Um.

好吧,我猜我们家乡出了点问题。
OK, I guess there is something wrong in our home state.

让我们再试一次。
Let's try again.

但我想这样人们就会继续旋转。
But I guess in this way, the people will keep spinning.

是的,所以目前的错误是,拾取位置传感器通过的第一个周期,我们不会到达这里,因为我们实际上会进入另一个状态。
Yep, so what is currently wrong is that the first cycle where the pick position sensor becomes through, we won't get here because we will actually move into another state.

所以我们需要稍微改变一下它的结构,这样我们才能真正删除这一部分。
So we need to change a little bit the structure of this so we can actually remove this part.

让我们切断控件 X 并让这段代码运行,因为这样。
Let's cut the control X and have this code running because this.

我们为了变暖而跑还是可以的,因为它会在这里,我们可以这样把它移回这里。
Is still OK for us to run for the warming, because it will here, we can move it back here this way.

这对于运行仍然很有用,因为它将管理所有产品,最后,如果一切正常,我们只会说。
And this is still useful to run because it will manage all the products and in the end, if everything is OK, we will just say.

在这里,他们在我们的基地。
Over here they are at our base, the.

如果机器是拥有的,他们会移除末端。
They removed the end if the machine is owned.

美国将转移到另一个州,所以一切都将在这个持续的状态下进行管理,如果机器武装起来,它将通往另一个州。
The US will move to another state, so everything will be managed in this ongoing state and if the machine is armed, it will lead to another state.

那么让我们回到线上看看它是如何工作的。
So let's go back online and see how it works.

为了我们。
For us.

好的,钻孔正在进行,让我们再试一次。
OK, the drilling is happening, let's try again.

之前也是同样的情况。
The same thing is before.

我只是,你知道,我会把它删除。
I would just, you know, I will remove it.

我开始,希望人们停在正确的位置。
I will start and I hope that people will stop at the correct position.

是的。
Yes.

机器将按照我们的预期启动。
And the machine will start as we intended it to.

好的,我们成功实施了停止和紧急情况。
OK, so we managed to implement the stop and the emergency.

那么我们现在要做的就是实现整个流程,整个流程比较棘手,我们可以通过这种方式来实现。
So what we need to do now is to implement the whole procedure, the whole procedure is quite tricky and we can do it in this way.

当我们持有时,我们需要真正记住当我们真正决定运行旧程序时我们所处的状态。
We when we hold, we need to actually remember the state that we were into when we actually decided to run the old procedure.

所以。
So.

在这里,我们现在能做的就是。
Here, what we can do for now is.

这里,如果状态不为零。
Here, if the state is not zero.

并且我们按下了保持按钮,那么我们还应该检查我们是否处于停止状态。
And we press the hold button, then we should also check if we are in the stopping state.

因此,如果我们要停止,我们不想在程序上拖延。
So if we are stopping, we don't want to hold this up in procedure.

因此,状态与 1000 不同,并且我们按下了一个旧按钮,那么我们需要做的就是在此处写入一个旧状态,它是一个无符号整数。
So and the state is different from 1000 and we have an old button being pressed, then what we need to do is write somewhere here, an old state that is an unsigned integer.

还有。
And the.

如果我们处于旧状态,在这个旧状态,抱歉,我们需要纠正我们当前的状态,所以你的整个状态应该成为我们的状态,然后我们需要进入,呃,保罗的状态,我们等待整个状态即将被删除。
If we are in an old state here in this old state, sorry, we need to right our current state, so your whole state should become our state and then we need to go into, uh, Paul's state where we wait for the whole state to be removed.

假设这个州变成了,假设是五百,这将是我们的家乡州。
So let's say the state becomes, let's say five hundred and this will be our home state here.

这是正确的。
That's right.

旧状态。
Old state.

这将是五百。
And this will be five hundred.

而在该状态下,我们只需要等待最终的按住按钮移除,如果不是旧按钮,那么状态应该回到旧状态,而整个状态应该变为零。
And in the state, we just need to wait to for the ultimate hold button to remove, if not old button, then the state should get back to be the old state while the whole state should become zero.

这样,当我们按住 时,机器会将当前状态保存到旧的可行状态中,我们将执行此操作。
In this way, when we press hold the the machine will save the current state into this old state viable and we will do it.

然后当按住按钮被移除时,状态可以回到我们之前的原始状态。
Then when the hold button is removed, the state can go back to the original state that we had before.

那么我们来尝试一下吧。
So let's try it.

这样就可以进行下载了。
That's carry out to download.

现在,让我们看一下可视化效果,没错。
Now, let's look at the visualisations, so that's right.

我留在这里。
I hold here.

他们删除了旧的。
And they removed the old.

让我们看看,有些东西不起作用。
Let's see, something is not working.

是的,当然,因为我还需要确定我不在其中。
Yes, of course, because I also need to be sure that I'm not in the.

整个状态,因此状态应该不同于 0、500 和 1000。
The whole state, so states should be different from zero, from 500 and from 1000.

那么让我们再试一次。
So let's try this again.

呃,抱歉,我需要一个下载器,所以我会加热 p.l.c.
Uh, sorry, I would need a downloader, so I will warm the p.l.c.

并在关闭可视化时重新开始,并在此处再次打开它。
and start again at the close the visualisations and open it up again here.

那么让我们再试一次。
So let's try again.

开始。
Start.

噢,抱歉,我来晚了一点。
Oh, sorry, I was a little late.

我们暂且不说。
Let's hold no.

OK,一切都停止了。
OK, everything is stop the.

我取消了保留,我可以看到水平恢复了。
I removed the hold, I can see the level going back.

电梯正开到这里,我们稍等一下。
And the elevator going here, let's hold.

如果是向下移动的话。
If it was moving down.

那是旧的之一已经倒塌了。
That's one of the old is down.

而且还在上升,我们停下来吧。
And is going up, let's stop.

好吧,又是旧的了。
OK, that's old again.

好吧,在这里你可以看到一个问题,空气仍在泵送,我们不希望这样。
OK, here you can see one issue, the air is still pumping, we don't do not want that.

如果对所有人来说,我们构建软件的方式正在发生变化。
And if it were to all the one, the table is moving for how we built our software.

他们会继续移动,因为我们正处于桌子在这里移动的状态,我们停了下来。
And they will keep moving because we are in a state where the table is moving here, we stopped.

我们可以看到我们停在状态 120,在状态 120,我们正在等待传感器。
We can see that we stop in the state one hundred and twenty and in one hundred and twenty, we are waiting for the sensor and.

该表并未停止。
The table is not being stopped.

所以我们在这里能做的是。
So what we can do over here is.

这个简单的事情我们需要做。
This simple thing we need to.

比如说,我们不接受保留哪些州?
Say, which are the states there that we do not accept to hold?

那么,让我们前往我们无法停留的州吧。
So let's head over here to the states where we we cannot stop.

我们无法保留我们的计划。
We cannot hold our program.

所以我们肯定不能等待。
So surely we cannot wait.

我们不能将程序保持在状态 120,因为这将为继续运行奠定基础。
We cannot hold the program in state one hundred and twenty because this will lay the table to keep moving.

每当钻头移动或激活处于活动状态时,我们就无法拥有所有状态。
We cannot have this all the state whenever the drill is moving or the activation is is active.

所以国家援助对我们来说不合适。
So state aid is not okay for us.

90 州则不然。
State 90 isn't.

而 Theta 110 不是,所以我们还需要删除这个状态,所以我说的状态是 80,状态等于 90,状态等于。
And that's Theta 110 isn't so we need to also remove this states, so state I said 80 and state equal to 90 and state equal to.

一百一十。
Hundred and ten.

我知道这一点,并且以这种方式,如果我们坚持的话。
I know this and and in this way, if we hold.

当桌子移动时,对不起,我犯了一些错误。
When a table is moving, I'm sorry, I have made some error.

是的,我忘记了,我们不会接受保留。
Yes, I forgot one and we will not accept the hold.

但实际上这不是我们想要的,因为假设我们在桌子旋转时按下保持键。
But actually this is not what we want because let's say that we press hold when the table is rotating.

这样,保留的请求就很简单了,直接被忽略即可。
In this way, the request to hold was simple, simply be ignored.

因此,我们需要想出另一种机制,即创建一个变量,我们将其称为玻利安变量的请求。
So we need to come up with another mechanism when we can do is create a variable that we will call the request that is a Bolian variable.

在这里我们可以说,每当按下固定底部时。
And here we can say that whenever the hold bottom is being pressed.

因此,如果我们不处于我们之前所说的这三种状态,那么让我们 Karpeles,如果我们还活着,如果机器关闭,如果机器已经旧了,或者如果机器已经处于不间断状态,然后我们有旧的按钮并按住按钮,然后我们将把这个旧的请求设置为通过。
So instead, if we are not in these three states that we said before, so let's Karpeles, if we are not still live, if the machine is off, if the machine is already old, or if the machine is already is in unstopping state, then and we have the old button and hold the button, then we shall set this old request to through.

然后,当我们处理实际的保持按钮时,我们需要检查所有请求,所以让我们删除这些东西,在这里而不是所有按钮,我们将以这种方式编写所有请求,如果请求出现在这些非法状态之一,请求将会通过,我们不会做任何事情,因为这个 if 语句不会被处理。
Then we need to check the all the requests when we are processing the actual hold button, so let's remove these things and here instead of all button, we will write all requests in this way, if a request comes up in one of these illegal states, the request will be come through and we won't do anything because this if statement will not be processed.

但一旦我们离开这个状态,所有的请求都将被实际接受,我们将保留。
But as soon as we leave this that state, the all the requests will be will be actually taken and we will hold.

当然,我们需要做的其他事情是,如果我们的机器停在这里,我们可以将所有请求设置为 false。
Other things that we need to do is, of course, if we have if our machine has stopped here, we can set the all the request to false.

现在让我们尝试一下。
Let's try this now.

让我们通过下载来看看。
Let's look in with a download.

让我们启动程序,看看会发生什么。
Let's start the program and let's see what happens.

开始。
Start.

让我们看看我是否调用了真正正在移动的那个。
Let's see if I call the one that really is moving.

哦,他们没听懂。
Oh, they didn't get it.

好的。
OK.

呃,有什么东西没起作用。
Uh, something didn't work.

呃,让我看看为什么。
Uh, let me see why.

状态依旧。
State is still.

500。

500.

呃,500。
Uh, 500.

旧状态下,变成五百哦,不好意思。
Under the old state, as it becomes five hundred oh, sorry.

嗯,当然咯。
Yeah, of course.

嗯,当我收到旧请求时,是的,抱歉,首先我需要保持这个与 500 不同的条件状态,而且我需要重置旧请求,因此请求必须变为 false。
Um, when I get an old request, yes, sorry, first I need to maintain this this conditional state different from 500 and also I need to reset the old requests so the requests must become false.

既然我已经处理了请求,嗯。
So since I have processed the request, um.

好的。
OK.

再次下载非常困难,我们试试吧。
It's very hard to download again, and let's try.

开始。
Start.

我会尝试老不真实的活跃。
I will try to old weren't real is active.

现在,我按下按钮,机器正在移动,一旦我停用真实机器,机器就会停止模型按钮。
Right now, I pressed the button, the machine is moving and as soon as I deactivated the real the machine stopped for model button.

您可以看到一切正常。
You can see everything is working.

当有这个工作时,让我们再试一次。
Let's try again when there is this working.

好的,现在,它到了顶峰。
OK, right now, it top.

我把它去掉。
I remove it.

让我们用表格再试一次。
Let's try again with the table.

好的,如果我删除条件,它就停止了。
OK, it is stop there if I remove the condition.

一切正常,所以我们设法实现所有这些功能,即停止、保持机器的紧急功能,我们实际上处于良好状态。
Everything works, OK, so we manage to implement all of this functionality is the stop, hold emergency functionality for our machine and we are actually in a good way.

我们正在管理当时机器所需的一切。
We are managing everything that we need for our machine at the time.

而且,呃,但是正如你所看到的,它非常慢。
And, uh, but as you can see, it is quite slow.

我们一次处理一种产品,这不是最佳方法。
We are processing one product at a time and this is not the optimal way to go.

我们,嗯,机器的很多组件、很多设备可以在我们现在等待的时候做一些事情,所以我们可以以更有效的方式,然后以更模块化的方式来做这件事。
We, um, a lot of components, a lot of equipments of the machine could be doing something while we are waiting right now so we can do this in a more efficient way and then the more modular way.

因此,在下一个视频中,我们将尝试以另一种方式打破状态机,以便能够实际并行执行不同的操作。
So in the next video, we will try to break up with the state machine in another way in order to be able to actually carry out different operations in parallel.

所以这很重要。
So this is important.

这是我们编写 APRC 软件时的一个关键概念,在接下来的视频中,我们将看到模块化的实际两个应用程序应用程序。
This is a key concept when we are writing APRC software and in the next videos we you will see an actual two applications application of modularity.